package _0_语法._4_循环._2_双循环;

public class _12_阶乘2_1 {

    public static void main(String[] args) {
        double sum = 0.0;   // 和
        double product = 1; // 乘积

        for (int i = 1; i <= 10; i++) {
            product = product * i; // 利用上次的阶乘结果，计算当前阶乘
            sum = sum + 1 / product;
        }
        System.out.println("sum = " + sum);
    }
}
